﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;



public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["PopUped"]==null)
        {
            Session.Add("PopUped", "true");
            NewsDataClassesDataContext dc = new NewsDataClassesDataContext();

            var OtherInfo = from OtherInfos in dc.OtherInfos
                            where ((OtherInfos.OtherInfo_id.Equals(3) || OtherInfos.OtherInfo_id.Equals(4)) && OtherInfos.isPublished.Equals(1))
                            select new
                            {
                                OtherInfo_id=OtherInfos.OtherInfo_id,
                                published = OtherInfos.isPublished
                            };
            foreach (var otherInfo in OtherInfo)
            {
                if (otherInfo.published==1)
                {
                    if (otherInfo.OtherInfo_id==3)
                    {
 //                   Session.Add("PopUp" + otherInfo.OtherInfo_id.ToString(), otherInfo.OtherInfo_id.ToString());
                        Response.Write("<script>window.showModelessDialog(\"PopUpPage.aspx?id=3\",0,\"Scroll:1;HttpValidationStatus:0;ListSourceHelper:0;resizable:1;dialog-Width:800px;dialog-Height:500px\");</script>");
                    //         Response.Write("<script>window.open(\"PopUpPage.aspx\",\"_Blank\")</script>");
                    } 
                    else if (otherInfo.OtherInfo_id == 4)
                    {
                        //                   Session.Add("PopUp" + otherInfo.OtherInfo_id.ToString(), otherInfo.OtherInfo_id.ToString());
                        Response.Write("<script>window.showModelessDialog(\"PopUpPage.aspx?id=4\",0,\"Scroll:1;HttpValidationStatus:0;ListSourceHelper:0;resizable:1;dialog-Width:800px;dialogHeight:500px\");</script>");
                        //         Response.Write("<script>window.open(\"PopUpPage.aspx\",\"_Blank\")</script>");
                    } 
                }
            }
            dc.Dispose();       
        }
    }
}
